"""
    Controller for Faculty dictionary table.
"""

from mnemoply.model.field import Faculty
from mnemoply.controllers.lookup import LookupController, TableCol, SQLObjectLookupDataSource
from mnemoply.controllers.crud import CRUDController

class FacultyController(LookupController, CRUDController):
    model_object = Faculty
    lookup_columns = [
        TableCol(name='name', caption=_('Name')),
        TableCol(name='abbr', caption=_('Letter')),
        ]
    view_fields = ['name', 'abbr']

    def __init__(self):
        LookupController.__init__(self,
            data_source=SQLObjectLookupDataSource(self.model_object),
            columns=self.lookup_columns,
            title=self.model_object.model_title,
        )
        CRUDController.__init__(self, model_object=self.model_object)

exposed = FacultyController()
